package plus.decl;
import java.util.*;

import plus.Gripe;
import plus.Type;
import plus.VScope;

public class D_Var extends Declaration {
	final int lineNr;
	final List<String> names;
	final TypeSpec typespec;
	public D_Var(int lineNr, List<String> names, TypeSpec typespec) {
		this.names = names;
		this.typespec = typespec;
		this.lineNr = lineNr;
	}
	void introduce() {
		if (null == typespec) {
			for (String name: names) {
				VScope.current.add_local(name, lineNr, Type.variable());
			}
		} else {
			Type type = typespec.interpret();
			for (String name: names) {
				VScope.current.add_local(name, lineNr, type);
			}
		}
	}
	public void export() {
		throw new Gripe("Can't (yet?) export variables from modules. Put them in the implementation section instead.");
//		M_User.current.
	}
}
